#Boa:Frame:Frame1

import wx

def create(parent , app ):
    return Frame1(parent, app )

[wxID_FRAME1, wxID_FRAME1BUTTONINITMYBATTLEFIELD, wxID_FRAME1BUTTONLOGOUT, 
 wxID_FRAME1BUTTONMESSAGES, wxID_FRAME1BUTTONMYBATTLEFIELD, 
 wxID_FRAME1BUTTONPLAYERS, wxID_FRAME1BUTTONREADY, wxID_FRAME1STATICLINE1, 
 wxID_FRAME1STATICLINE2, wxID_FRAME1STATICTEXT1, 
] = [wx.NewId() for _init_ctrls in range(10)]

class Frame1(wx.Frame ):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
              pos=wx.Point(429, 133), size=wx.Size(165, 450),
              style=wx.DEFAULT_FRAME_STYLE, title=u'Control centre')
        self.SetClientSize(wx.Size(157, 423))
        self.Center(wx.BOTH)
        self.SetWindowVariant(wx.WINDOW_VARIANT_NORMAL)
        self.SetMaxSize(wx.Size(165, 450))
        self.Bind(wx.EVT_CLOSE, self.OnButtonLogoutButton)

        self.buttonInitMyBattlefield = wx.Button(id=wxID_FRAME1BUTTONINITMYBATTLEFIELD,
              label=u'Init my battlefield', name=u'buttonInitMyBattlefield',
              parent=self, pos=wx.Point(8, 8), size=wx.Size(144, 25), style=0)
        self.buttonInitMyBattlefield.SetMinSize(wx.Size(150, 25))
        self.buttonInitMyBattlefield.Bind(wx.EVT_BUTTON,
              self.OnButtonInitMyBattlefieldButton,
              id=wxID_FRAME1BUTTONINITMYBATTLEFIELD)

        self.buttonPlayers = wx.Button(id=wxID_FRAME1BUTTONPLAYERS,
              label=u'Players', name=u'buttonPlayers', parent=self,
              pos=wx.Point(8, 112), size=wx.Size(144, 25), style=0)
        self.buttonPlayers.Bind(wx.EVT_BUTTON, self.OnButtonPlayersButton,
              id=wxID_FRAME1BUTTONPLAYERS)

        self.buttonMyBattlefield = wx.Button(id=wxID_FRAME1BUTTONMYBATTLEFIELD,
              label=u'My battlefield', name=u'buttonMyBattlefield', parent=self,
              pos=wx.Point(8, 144), size=wx.Size(144, 25), style=0)
        self.buttonMyBattlefield.Bind(wx.EVT_BUTTON,
              self.OnButtonMyBattlefieldButton,
              id=wxID_FRAME1BUTTONMYBATTLEFIELD)

        self.buttonReady = wx.Button(id=wxID_FRAME1BUTTONREADY, label=u'Ready',
              name=u'buttonReady', parent=self, pos=wx.Point(8, 40),
              size=wx.Size(144, 25), style=0)
        self.buttonReady.Bind(wx.EVT_BUTTON, self.OnButtonReadyButton,
              id=wxID_FRAME1BUTTONREADY)

        self.buttonMessages = wx.Button(id=wxID_FRAME1BUTTONMESSAGES,
              label=u'Messages', name=u'buttonMessages', parent=self,
              pos=wx.Point(8, 80), size=wx.Size(144, 25), style=0)
        self.buttonMessages.Bind(wx.EVT_BUTTON, self.OnButtonMessagesButton,
              id=wxID_FRAME1BUTTONMESSAGES)

        self.staticLine1 = wx.StaticLine(id=wxID_FRAME1STATICLINE1,
              name='staticLine1', parent=self, pos=wx.Point(8, 72),
              size=wx.Size(144, 2), style=0)

        self.staticLine2 = wx.StaticLine(id=wxID_FRAME1STATICLINE2,
              name='staticLine2', parent=self, pos=wx.Point(8, 176),
              size=wx.Size(144, 2), style=0)

        self.buttonLogout = wx.Button(id=wxID_FRAME1BUTTONLOGOUT,
              label=u'Logout', name=u'buttonLogout', parent=self,
              pos=wx.Point(8, 184), size=wx.Size(144, 25), style=0)
        self.buttonLogout.Bind(wx.EVT_BUTTON, self.OnButtonLogoutButton,
              id=wxID_FRAME1BUTTONLOGOUT)

        self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1,
              label=u'Sea Battle v 0.01 client', name='staticText1',
              parent=self, pos=wx.Point(11, 224), size=wx.Size(111, 13),
              style=0)

    def __init__(self, parent,app):
        self._init_ctrls(parent)
        self.app = app
        
    def OnButtonInitMyBattlefieldButton(self, event):
        self.app.dialog_init_my_battlefield.Show( True )
        self.SetTitle( self.app.player_name + ': control centre' )

    def OnButtonPlayersButton(self, event):
        self.app.dialog_players.Show( True )

    def OnButtonMyBattlefieldButton(self, event):
        self.app.dialog_my_battlefield.Show( True )

    def OnButtonReadyButton(self, event):
        self.app.server_proxy.ready()

    def OnButtonMessagesButton(self, event):
        self.app.dialog_messages.Show( True )

    def OnButtonLogoutButton(self, event):
        if( wx.MessageBox( message = 'really logout? ' , caption = 'confirm', style = wx.YES_NO )==wx.YES ):
            self.app.server_proxy.logout()
            self.Destroy()
        
    
